/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package isratrzabality.datalayer;

import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author Israel Ruiz
 */
public class Artefact implements java.lang.Comparable<Artefact>{

    private String id;
    private String name;
    private List<Artefact> referencesUp;
    private List<Artefact> referencesDown;

    public Artefact(String id, String name) {
        this.id = id;
        this.name = name;
    }

    public String getId() {
        return id;
    }

    public String getName() {
        return name;
    }

    public void addArtefactUp(Artefact art) {
        this.referencesUp = this.referencesUp == null
                ? new ArrayList<Artefact>() : this.referencesUp;
        this.referencesUp.add(art);
    }

    public void addArtefactDown(Artefact art) {
        this.referencesDown = this.referencesDown == null
                ? new ArrayList<Artefact>() : this.referencesDown;
        this.referencesDown.add(art);

    }

    public List<Artefact> returnListDown() {
        return referencesDown;
    }

    public List<Artefact> returnListUp() {
        return referencesUp;
    }
    public String toString (){
        return name;
    }

    @Override
    public int compareTo(Artefact o) {
        return this.name.compareTo(o.name);
    }
}
